package com.ineatconseil.yougo.client.ui.main.application;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.ineatconseil.yougo.client.ui.common.ClientFactory;
import com.ineatconseil.yougo.client.ui.main.application.header.HeaderActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.TabsActivity;

/**
 * @author Benjamin Barbier - Ineat Conseil
 */
public class ApplicationActivity extends AbstractActivity implements IApplicationView.Presenter {

	private final ClientFactory clientFactory;
	private IApplicationView applicationView;
	
	public ApplicationActivity(ApplicationPlace place, ClientFactory clientFactory) {
		System.out.println("ApplicationActivity - constructor");
		this.clientFactory = clientFactory;
	}
	
	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		System.out.println("ApplicationActivity.start()");
		
		applicationView = clientFactory.getApplicationView();
		
		applicationView.addWidgetInMainVerticalPanel(
				clientFactory.getHeaderView(), 
				new HeaderActivity(clientFactory));
		
		applicationView.addWidgetInMainVerticalPanel(
				clientFactory.getTabsView(),
				new TabsActivity(clientFactory));
		
		panel.setWidget(applicationView);
		
	}

}
